(deftemplate Pacient
    (slot nume)
    (slot temperatura)
    (slot tuse)
    (slot durereCap)
    (slot respiratia)   ;resp suieratoare=insuficienta cardiaca
    (slot starePiele) ; pete rosii = psoriazis
    (slot stareOchi) ;ochi imflamati si rosii = conjunctivita
    
    )
(assert (Pacient(nume Petru)(temperatura mare)(tuse da)(durereCap da)(respiratia normala)(starePiele normala)(stareOchi normala)))
(assert (Pacient(nume Pop)(temperatura normala)(tuse nu)(durereCap nu)(respiratia suieratoare)(starePiele normala)(stareOchi normala)))
(assert (Pacient(nume Vasile)(temperatura normala)(tuse nu)(durereCap nu)(respiratia normala)(starePiele pete-rosii)(stareOchi normala)))
(assert (Pacient(nume Dora)(temperatura normala)(tuse nu)(durereCap nu)(respiratia normala)(starePiele normala)(stareOchi inflamati-rosii)))
(assert (Pacient(nume Paul)(temperatura normala)(tuse nu)(durereCap nu)(respiratia normala)(starePiele normala)(stareOchi normala)))

(facts)
(run)


(defrule raceala
    (Pacient (nume ?n))
    (Pacient(nume ?n)(temperatura mare)( tuse da)(durereCap da))
=>
	(printout t "Pacientul " ?n " este racit!" crlf)
    )

(run)

(defrule gripa
    (declare (salience 10))
    (Pacient (nume ?m))
    (Pacient (nume ?m)(temperatura mare)( tuse da)(durereCap da))
=>
	(printout t "Pacientul " ?m " are gripa!" crlf)
    )

(run)

(defrule conjunctivita
    (Pacient (nume ?n))
    (Pacient(nume ?n)(stareOchi inflamati-rosii))
=>
	(printout t "Pacientul " ?n " are conjunctivita!" crlf)
    )

(run)

(defrule insuficienta-cardiaca
    (Pacient (nume ?n))
    (Pacient(nume ?n)(respiratia suieratoare))
=>
	(printout t "Pacientul " ?n " are insuficienta cardiaca!" crlf)
    )

(run)

(defrule psoriazis
    (Pacient (nume ?n))
    (Pacient(nume ?n)(starePiele pete-rosii))
=>
	(printout t "Pacientul " ?n " are psoriazis!" crlf)
    )

(run)

(defrule sanatos
    (Pacient (nume ?n))
    (Pacient(nume ?n)(temperatura normala)(tuse nu)(durereCap nu)(respiratia normala)(starePiele normala)(stareOchi normala))
=>
	(printout t "Pacientul " ?n " este sanatos!" crlf)
    )

(run)
    
    